import request from '@/utils/request'

// 聚合接口

// 编辑
export function editBondInfo (params) {
  var data = fromData(params)
  return request({
    url: 'bond/editInfo',
    method: 'post',
    data
  })
}

// 获取聚合接口信息
export function getBondInfo (params) {
  var data = fromData(params)
  return request({
    url: 'bond/getInfo',
    method: 'post',
    data
  })
}

// 获取聚合接口列表
export function getBondArray (params) {
  var data = fromData(params)
  return request({
    url: 'bond/getArray',
    method: 'post',
    data
  })
}

// 配置
export function setBondInfo (params) {
  var data = fromData(params)
  return request({
    url: 'bond/setInfo',
    method: 'post',
    data
  })
}

function fromData (params) {
  let formData = new FormData()
  for (const it in params) {
    if (!Object.is(params[it], null) && !Object.is(params[it], '')) {
      formData.append(it, params[it])
    }
  }
  return formData
}
